<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>The source code</title>
  <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  <style type="text/css">
    .highlight { display: block; background-color: #ddd; }
  </style>
  <script type="text/javascript">
    function highlight() {
      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
    }
  </script>
</head>
<body onload="prettyPrint(); highlight();">
  <pre class="prettyprint lang-js">&lt;?php
namespace Library\Config;

class Ini
{
	private $_config;
	
	public function __construct($filename)
	{
		$this-&gt;_config = $this-&gt;_fixIni(parse_ini_file($filename, true));
	}
	
	private function _fixIni($ini_array)
	{
		$new_array = array();
		
		foreach($ini_array as $key =&gt; $value)
		{
			if (strstr($key, '.') !== false)
			{
				$parts = explode('.', $key);
				$new_array[$parts['0']][$parts['1']] = $value;
				
				continue;
			}
			
			$new_array[$key] = $this-&gt;_fixIni($value);
		}
		
		return $new_array;
	}
	
	public function getData()
	{
		return $this-&gt;_config;
	}
}
</pre>
</body>
</html>
